package DailyPractice.Day11;

import java.util.Scanner;

/**
 * 连续最大比特数
 * @author lumin
 * @date 2022/05/06 19:55
 **/
public class Num2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        int LNum = 0;
        for (int i = 0; i < 32; i++) {
            if((n & (1 << i)) != 0){
                count++;
            }else{
                LNum = Math.max(count,LNum);
                count = 0;
            }

        }
        System.out.println(LNum);
    }
}